package com.zhny.sensor.dao;

import com.zhny.sensor.entity.PoultryCategory;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @Auther: zhy
 * @Date: 2019/11/22
 * @Description: 禽类品种信息管理
 */
public interface PoultryCategoryRepository extends JpaRepository<PoultryCategory,String> {

    @Query(value = "select * from poultry_category where slaughterHouseId = ?1 limit 5 ",nativeQuery = true)
    List<PoultryCategory> findAllBySlaughterHouseId(String slaughterHouseId);

    List<PoultryCategory> findAllByCreateBy(String createBy);

    @Query(value = "select * from poultry_category where parentId = ?1 limit 5 ",nativeQuery = true)
    List<PoultryCategory> findAllByParentId(String parentId);

    List<PoultryCategory> findAllByNumberAndCreateBy(String number, String createBy);

    @Query(value = "select * from poultry_category where stallId = ?1 limit 5",nativeQuery = true)
    List<PoultryCategory> findAllByStallId(String stallId);
}
